package com.zrrd.yt.webll.controller;

import com.zrrd.yt.common.result.Result;
import com.zrrd.yt.order.client.OrderFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Map;

@Controller
public class OrderController {

    @Autowired
    private OrderFeignClient orderFeignClient;

    //订单结算
    @GetMapping("trade.html")
    public String trade(Model model){
        //通过feign请求订单服务获取结算数据
        Result<Map> result = orderFeignClient.trade();
        //存入model
        model.addAllAttributes(result.getData());
        //转发给页面
        return "order/trade";
    }
}
